//
//  RGMessageCommentCell.m
//  RedGrass
//
//  Created by wuyine on 2019/1/28.
//  Copyright © 2019年 hongcaosp. All rights reserved.
//

#import "RGMessageCommentCell.h"

@implementation RGMessageCommentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(RGMessageContactModel *)model {
    [self.userIcon setImageWithURL:[NSURL URLWithString:model.image] placeholder:IMAGE_NAMED(@"头像1")];
    self.userName.text = model.nickname;
    self.contentLabel.text = model.comment;
    NSString *timeStr = @"";
    if(model.createTime){
        timeStr = [NSDate dateWithTimeStamp:[NSString stringWithFormat:@"%@",model.createTime] withFormatter:@"MM-dd HH:mm"];
    }
    if(model.messageType == 3){//"@"  1(赞评论/@评论),2(赞作品/@作品)
        if(model.typeChild == 1){
            self.dateLabel.text = [NSString stringWithFormat:@"在评论中提到了你 %@", timeStr];
        }else if(model.typeChild == 2){
            self.dateLabel.text = [NSString stringWithFormat:@"在作品中提到了你 %@", timeStr];
        }else{
            self.dateLabel.text = timeStr;
        }
    }else if (model.messageType == 4){//评论
        if(model.typeChild == 1){
            self.dateLabel.text = [NSString stringWithFormat:@"评论了你的评论 %@", timeStr];
        }else if(model.typeChild == 2){
            self.dateLabel.text = [NSString stringWithFormat:@"评论了你的作品 %@", timeStr];
        }else{
            self.dateLabel.text = timeStr;
        }
    }
//    self.dateLabel.text = [NSDate dateWithTimeStamp:[NSString stringWithFormat:@"%@",model.createTime] withFormatter:@"MM-dd HH:mm"];
    [self.image setImageWithURL:[NSURL URLWithString:model.coverPath] placeholder:IMAGE_NAMED(@"组6")];
}

@end
